#pragma config(Hubs,  S1, HTMotor,  HTMotor,  none,     none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,     rearLeft,      tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C1_2,     rearRight,     tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S1_C2_1,     frontLeft,     tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_2,     frontRight,    tmotorTetrix, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c"

task main()
{
	int x1 = 0;
	int y1 = 0;
	int x2 = 0;
	const int t = 5;

	while ( true ) {

		getJoystickSettings(joystick);

		//Holonomic Drive

	x1 = ( abs( joystick.joy1_x1 ) > t ) ? joystick.joy1_x1 : 0;
	y1 = ( abs( joystick.joy1_y1 ) > t ) ? joystick.joy1_y1 : 0;
	x2 = ( abs( joystick.joy1_x2 ) > t ) ? joystick.joy1_x2 : 0;

		motor[frontLeft] = y1 + x2 + x1;
		motor[frontRight] = y1 - x2 - x1;
		motor[rearLeft] = y1 + x2 - x1;
		motor[rearRight] = y1 - x2 + x1;
}}
